import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskStepVO, TaskStepForm, TaskStepQuery } from '@/api/pm/taskStep/types';

/**
 * 查询任务步骤列表
 * @param query
 * @returns {*}
 */

export const listTaskStep = (query?: TaskStepQuery): AxiosPromise<TaskStepVO[]> => {
  return request({
    url: '/pm/taskStep/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务步骤详细
 * @param id
 */
export const getTaskStep = (id: string | number): AxiosPromise<TaskStepVO> => {
  return request({
    url: '/pm/taskStep/' + id,
    method: 'get'
  });
};

/**
 * 新增任务步骤
 * @param data
 */
export const addTaskStep = (data: TaskStepForm) => {
  return request({
    url: '/pm/taskStep',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务步骤
 * @param data
 */
export const updateTaskStep = (data: TaskStepForm) => {
  return request({
    url: '/pm/taskStep',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务步骤
 * @param id
 */
export const delTaskStep = (id: string | number | Array<string | number>) => {
  return request({
    url: '/pm/taskStep/' + id,
    method: 'delete'
  });
};
